import axios from 'axios'
// axios全局默认设置请求基准路径
axios.defaults.baseURL = 'http://localhost:8888/api'

// 获取图片列表顶部部分
export const getImgCate = () => axios.get(`/getimgcategory`).then(res => res.data)

// 根据图片id获取图片列表部分
export const getImgList = (id) => axios.get(`/getimages/${id}`).then(res => res.data)

// 图文详情缩略图
export const getimgMage = (id) => axios.get(`/getthumimages/${id}`).then(res => res.data)

// 缩略图获取描述
export const getMageInfo = (id) => axios.get(`/getimageInfo/${id}`).then(res => res.data)
// 获取评论列表
export const getCommentsList = (id, pageindex) => axios.get(`/getcomments/${id}?pageindex=${pageindex}`).then(res => res.data)
// 发表评论
export const postSubmitCommet = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)
// 获取新闻列表的接口
export const getNews = () => axios.get('/getnewslist').then(res => res.data)
// 获取新闻详情接口
export const getNewsDetail = (id) => axios.get(`/getnew/${id}`).then(res => res.data)
// 获取商品列表
export const getGoodsList = pageIndex => axios.get(`/getgoods?pageindex=${pageIndex}`).then(res => res.data)
// 获取商品价格及描述
export const getInfo = id => axios.get(`/goods/getinfo/${id}`).then(res => res.data)
// 商品列表详情轮播图
export const getthum = id => axios.get(`/getthumimages/${id}`).then(res => res.data)
// 获取商品图文介绍
export const getDesc = id => axios.get(`/goods/getdesc/${id}`).then(res => res.data)
// 获取购物车页面数据
export const getShopCar = id => axios.get(`/goods/getshopcarlist/${id}`).then(res => res.data)
